﻿; (function (window, undefined, $) {
    $(document).ready(function () {
        var gridopt = {
            url: options.listUrl,
            colModel: [
                    { display: '编号', name: 'ID', width: "10%", sortable: true, hide: true, align: 'left', iskey: true },
                    { display: '标号', name: 'ProjectNo', width: "10%", sortable: false, align: 'left' },
                    { display: '项目名称', name: 'ProjectName', width: "27%", sortable: false, align: 'left' },
                    { display: '募集金额', name: 'TotalLoan', width: "10%", sortable: false, align: 'left'},
                    { display: '已收到金额', name: 'TenderSum', width: "5%", sortable: false, align: 'left' },
                    { display: '操作', name: 'ID', width: "18%", sortable: false, align: 'center', process: processOp }
            ],
            sortname: "ID",
            sortorder: "ASC",
            title: false,
            rp: 15,
            usepager: true,
            showcheckbox: false
        };
        var xjgrid = new xjGrid("gridlist", gridopt);

        function processOp(value, cell) {
            var ops = [];
            ops.push("&nbsp;<a title='查看' href='javascript:;'  onclick=\"util.Detail('", value, "')\"><i class='fa fa-edit' ></i>查看</a>");
            ops.push("&nbsp;<a title='满标' href='javascript:;'  onclick=\"util.ManBIao('", value, "')\"><i class='fa fa-edit' ></i>满标</a>");
            return ops.join("");
        }

        //查看
        util.Detail = function (id) {
            var url = options.RevokeUrl + "?ProjectId=" + id;
            location.href = url;
        };
        
        util.ManBIao = function (id) {
            $.ajax({
                url: "/FinanceMgr/ManBiao ",
                type: "Post",
                success: function (data) {
                    //var obj = JSON.parse(data);
                    alert(data);
                    xjgrid.Reload();
                },
                data: "id=" + id //这里没有参数可以不穿
            });
        };
    });

})(window, undefined, jQuery);